import {Graph, KeyHandler} from "@maxgraph/core"
import {deleteNode, cut, paste, copy} from "@/publicFuns/graphAction.ts";


export default function(graph: Graph) {
    // 启动盘事件键
    const keyHandler: KeyHandler = new KeyHandler(graph)
    // 键盘按下删除键绑定事件
    keyHandler.bindKey(46, () => {
        deleteNode(graph)
    });
    keyHandler.bindControlKey(65, () => {
        console.log('all')
        graph.selectAll();
    });
    keyHandler.bindControlKey(67, () => {
        copy(graph);
    });
    keyHandler.bindControlKey(88, () => {
        cut(graph);
    });
    keyHandler.bindControlKey(86, () => {
        paste(graph);
    });
}